//
//  IObject.h
//  bird
//
//  Created by Xiaochen Lian on 5/2/12.
//  Copyright (c) 2012 University of California, Los Angeles. All rights reserved.
//

#ifndef bird_object_h
#define bird_object_h

#include <vector>
#include "common.h"
#include "wingbeat_param.h"


enum PART_TYPE {ROOT, BODY, SHOULDER, FOREARM, WRIST, FEATHER};

class IEntity {
public:
    IEntity();
    ~IEntity();
    bool is_visible();
    void set_visible(bool visible);
    PART_TYPE get_type();
    virtual void set_pos(const point4 &pos);
    point4 get_pos();
    void set_type(PART_TYPE type);
    void set_wingbeat_param(int id, IWingbeat_param* wb);
    
    virtual void build_model() = 0;
    virtual void draw(const mat4 &tfm_parent) = 0;    
    virtual void add_child(IEntity *part);
    virtual void update(GLfloat phi);
    
protected:
    bool m_visible;
    PART_TYPE m_type;
    point4 m_model_pos;
    mat4 m_tfm, m_rotate_mat, m_scale_mat;
    ShapeData m_shape_data;
    
    IWingbeat_param* wingbeat_params[3];
    std::vector<IEntity*> m_children;    
};

#endif
